class Route(object):
    intersection_id=''
    tollgate_id=0
    link_seq=[]
    
    def __init__(self,ii,ti,ls):
        self.intersection_id=ii
        self.tollgate_id=ti
        self.link_seq=ls

    def add_link_id(self,li):
        if isinstance(li,int):
            link_seq.append(li)

    def print_info(self):
        print ('intersection_id=%s tollgate_id=%d link_seq='
               %(self.intersection_id,self.tollgate_id)),self.link_seq

class Routes(object):
    
    def __init__(self):
        self.routes=[]

    def add_route(self,route):
        if isinstance(route,Route):
            self.routes.append(route)
        else:
            print 'not Route class'

    def print_info(self):
        for i in self.routes:
            i.print_info()

    def get_links(self):
        res=[]
        for i in self.routes:
            for j in i.link_seq:
                res.append(j)
        res=list(set(res))
        return res

def Routes_test():
    a=Route('A',5,[100,2])
    a.print_info()
    b=Routes()
    b.add_route(a)
    b.print_info()
